import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class Deck 
{
    ArrayList<Card> a = new ArrayList<Card>();
    int s = 0;
    int v = 0;
    Card[][] hands = new Card[4][13];
    
    public Deck()
    {
        for(int row = 0; row<4; row++)
        {
            for(int col = 0; col<13; col++)
            {
                a.add(new Card(col, row));
            }
        }
        
    }
    
    public void dealHands()
    {
        for(int row = 0; row<4; row++)
        {
            for(int col = 0; col<13; col++)
            {
                int num = (int)(Math.random()*a.size());
                hands[row][col] = a.get(num);
                //System.out.println(a.remove(num));
                a.remove(num);
            }
        }
        sortHands();
    }
    
    public Card[][] getHands() 
    {
        return hands;
    }
    
    private void sortHands()
    {
        for(int ctr = 0; ctr<4; ctr++)
        {
            ArrayList<Card> arr = new ArrayList<Card>(Arrays.asList(hands[ctr]));
            Collections.sort(arr);
            arr.toArray(hands[ctr]);
        }
    }
}
